package com.job.ZhangMeng.Homework0707.kszy;

public class Employee {
    private String name;
    private int age;

    public String getName() {
        return name;
    }
    public int getAge() {
        return age;
    }

    public void setName(String name) {
        this.name = name;
    }
    public void setAge(int age) {
        if(age<18 || age>60){
            System.out.println("年龄不符合,本次赋值失败!");
            return;
        }
        this.age = age;
    }

    public void showSelf(String name){
        System.out.println("大声对"+name+"说,我是："+this.name+"\t年龄："+age);//this指当前对象
        this.saySth();
        saySth();
    }

    public void saySth(){
        System.out.println("......");
    }

    public static int a=30;
    public static void show001(){
        System.out.println(Employee.a+a);
        Employee.show002();//静态方法内 可以调用 本类的静态方法或变量
        show002();
    }
    public static void show002(){
        //System.out.println(name);
        //静态方法内 不能调用 本类的成员方法或变量
    }

    public static void main(String[] args) {
        Employee emp=new Employee();
        emp.name="销户";
        emp.age=24;
        emp.showSelf("老王");
    }
}
